<template>
	<view class="container">
		<view class="mx-box">
			<view class="space-between">
				<view class="left">
					<view class="text">待提现佣金（元）</view>
					<view class="text1">{{userInfo.price}}</view>
				</view>
				<view class="right center" @click="goList">推广明细</view>
			</view>
			<view class="line"></view>
			<view class="mx">
				<view class="left1">
					<view class="text2">本月预计收益（元）</view>
					<view class="text3">{{info.currentMonthProfit || 0}}</view>
				</view>
				<view class="line1"></view>
				<view>
					<view class="text2">上月预计收益（元）</view>
					<view class="text3">{{info.lastMonthProfit || 0}}</view>
				</view>
			</view>
		</view>
		<view class="mx-box mt">
			<view class="tit">累计推广数据统计</view>
			<view class="mx mt">
				<view class="left1">
					<view class="text2">我的推广次数</view>
					<view class="text3">{{info.personalPromotionTimes || 0}}</view>
				</view>
				<view class="line1"></view>
				<view>
					<view class="text2">我的推广收益</view>
					<view class="text3">{{info.personalPromotionProfit || 0}}</view>
				</view>
			</view>
			<view class="mx mt" v-if="userInfo.jobId != 3">
				<view class="left1">
					<view class="text2">其他推广次数</view>
					<view class="text3">{{info.otherPromotionTimes || 0}}</view>
				</view>
				<view class="line1"></view>
				<view>
					<view class="text2">其他推广收益</view>
					<view class="text3">{{info.otherPromotionProfit || 0}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getProfitView,
		getUserInfo
	} from "../../api/active"
	export default {
		data() {
			return {
				info: {},
				userInfo: {}
			};
		},
		onLoad() {
			this.getInfo()
		},
		methods: {
			getInfo() {
				getUserInfo({
						userId: uni.getStorageSync("userId")
					})
					.then(res => {
						this.userInfo = res.data
					})
				getProfitView({
					userId: uni.getStorageSync("userId")
				}).then(res => {
					this.info = res.data
				})
			},
			goList() {
				uni.navigateTo({
					url: '../promotionList/promotionList'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100vw;
		min-height: 100vh;
		background: #F5F5F5;
		padding-top: 20rpx;
	}

	.mx-box {
		background: #fff;
		width: 100%;
		padding: 30rpx 43rpx;

		&.mt {
			margin-top: 20rpx;
		}
	}

	.tit {
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #333333;
	}

	.text {
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #333333;
	}

	.text1 {
		font-family: PingFang SC;
		font-weight: 800;
		font-size: 48rpx;
		color: #333333;
		margin-top: 10rpx;
	}

	.right {
		width: 150rpx;
		height: 50rpx;
		background: #005097;
		border-radius: 25rpx;
		font-weight: 500;
		font-size: 24rpx;
		color: #FFFFFF;
		margin-top: 15rpx;
	}

	.line {
		width: 100%;
		height: 2rpx;
		background: #F1F1F1;
		margin: 30rpx 0;
	}

	.mx {
		display: flex;

		&.mt {
			margin-top: 50rpx;
		}
	}

	.left1 {
		width: 50%;
	}

	.line1 {
		width: 2rpx;
		height: 65rpx;
		background: #F1F1F1;
		margin-right: 50rpx;
	}

	.text2 {
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #999999;
	}

	.text3 {
		font-weight: 800;
		font-size: 30rpx;
		color: #333333;
		margin-top: 10rpx;
	}
</style>